const http = require('http');

// 请求选项
const options = {
  hostname: 'localhost',
  port: 10003,  // API网关端口
  path: '/user-service/auth/register',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  }
};

// 用户注册数据
const userData = {
  username: 'testuser',
  password: 'testpassword',
  email: 'test@example.com',
  realName: '测试用户'
};

// 发送请求
const req = http.request(options, (res) => {
  console.log(`状态码: ${res.statusCode}`);
  
  res.on('data', (chunk) => {
    console.log(`响应内容: ${chunk}`);
  });
});

req.on('error', (error) => {
  console.error('请求错误:', error);
});

// 发送用户数据
req.write(JSON.stringify(userData));
req.end();